1. Field of the Invention
The present invention generally relates to image processing, and particularly to a method and an apparatus for image compression and decompression.
2. Description of Related Art
Various kinds of image formats such as bitmap (BMP), joint photographic experts group (JPEG), graphics interchange format (GIF), and so on are used for representing images. Particularly, the bitmap is a widely used image format that is generally represented with a two dimensional array of pixels. The bitmap is characterized by a number of bits per pixel (a color depth, which determines the number of colors it can represent).
Generally, each pixel of the bitmap has three individually defined color data: red, green, and blue. The amount of color information in each pixel determines the quality of the bitmap. Typically, each pixel of an uncompressed bitmap stores forty-eight bits digital data (sixteen bits corresponding to each color data) or twenty-four bits digital data (eight bits corresponding to each color data). A picture quality of the bitmap with forty-eight bits digital data is smoother than that with twenty-four bits digital data.
High-quality bitmap often takes up large amount of disk space, so some image compressing techniques sacrifice image quality to achieve a smaller file size. For example, one image compressing technique always drops lower three data bits of each color data that may be defined by eight bits, thereby a pixel is compressed from twenty-four bits to fifteen bits. However, this image compressing technique does not consider the color intensity factor of the bitmap during compressing. When the color intensity of the bitmap is relative low, the image quality may deteriorate and digital data for representing the color intensity of each pixel are mainly stored in the lower bits. If the lower data bits are dropped for compression, the image is greatly distorted after decompression.
Therefore, what is desired is to provide a method that is capable of compressing and decompressing images such as bitmap images considering color intensity factor and an apparatus for image compression and decompression is also desired.